<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
    <style>
        *{
            margin: 0px;
            padding: 0px;
            list-style: none;
        }
        textarea{
            width: 800px;
            margin: 10px auto;
            display: block;
            resize: none;
            outline: none;
            border: 1px solid wheat;
            background: url(images/bj.jpg);
        }
        button{
            width: 800px;
            margin: 10px auto;
            display: block;
            background-color:#fff;
            border: none;
            outline: none;
            line-height: 40px;
            cursor: pointer;
            color: hotpink;
        }
        ul{
            width: 800px;
            margin: 10px auto;
        }
        ul>li{
            background: wheat;
            margin-bottom:10px;
            position:relative ;
            cursor: pointer;
            padding: 4px;
        }
        span{
            position: absolute;
            right: 5px;
            top: 0px;cursor: pointer;
        }
    </style>
<body>
    <textarea name="" id="txt" cols="30" rows="10" placeholder="请输入内容哦，大聪明"></textarea>
    <button id="btn">微博发布</button>
    <ul id="box">
        <li>
            正在加载...
            <p>网络不佳</p>
            <span onclick="del(this)">X</span>
        </li>
    </ul>

    <script>
        btn.onclick=function(){
            if(txt.value==''){
                alert('输入内容才能发送哦亲~~')
            }else{
            var d=new Date();
            console.log(d)
            var year=d.getFullYear();
            var month=d.getMonth()+1
            var date=d.getDate()
            var val=txt.value;
            var tag=document.createElement('li');
            tag.innerHTML=` ${val}
            <p>${year}-${month}-${date}</p>
            <span  onclick="del(this)">X</span>`
            box.appendChild(tag);
            txt.value=''
        }
    }
    function del(a){
        a.parentNode.parentNode.removeChild(a.parentNode)
    }
    </script>
</body>
</html>